@extends('admin.main')

@section('body')
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>权限管理</h2>
    </div>

    <div class="tools auth-botton">
        <a id="add-group" class="btn" href="{{urlAdmin('auth','getAddGroup')}}">新 增</a>
        <a class="btn ajax-post" url="{{urlAdmin('auth','anyChangeStatus',['method'=>'resume'])}}"
           target-form="ids">启 用
        </a>
        <a class="btn ajax-post" url="{{urlAdmin('auth','anyChangeStatus',['method'=>'forbid'])}}"
           target-form="ids">禁 用
        </a>
        <a class="btn ajax-post confirm" url="{{urlAdmin('auth','anyChangeStatus',['method'=>'delete'])}}"
           target-form="ids">删 除
        </a>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">用户组</th>
                <th class="">描述</th>

                <th class="">授权</th>
                <th class="">状态</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            @if(count($rows['data']))
                @foreach($rows['data'] as $v)
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{{$v['id']}}"/></td>
                        <td><a href="{{urlAdmin('auth','getEditGroup',['id'=>$v['id']])}}">{{$v['title']}}</a></td>
                        <td><span>{{mb_strimwidth($v['description'],0,60,"...","utf-8")}}</span></td>
                        <td>
                            <a href="{{urlAdmin('auth','getAccess',['group_name'=>$v['title'],'group_id'=>$v['id']])}}">访问授权</a>
{{--                            <a href="{{urlAdmin('auth','getCategory',['group_name'=>$v['title'],'group_id'=>$v['id']])}}">分类授权</a>--}}
                            <a href="{{urlAdmin('auth','getAdmin',['group_name'=>$v['title'],'group_id'=>$v['id']])}}">成员授权</a>
                        </td>
                        <td>{{$v['status_text']}}</td>
                        <td>
                            @if($v['status'] == 1)
                                <a href="{{urlAdmin('auth','anyChangeStatus',['method'=>'forbid','id'=>$v['id']])}}"
                                   class="ajax-get">禁用</a>
                            @else
                                <a href="{{urlAdmin('auth','anyChangeStatus',['method'=>'resume','id'=>$v['id']])}}"
                                   class="ajax-get">启用</a>
                            @endif
                            <a href="{{urlAdmin('auth','anyChangeStatus',['method'=>'delete','id'=>$v['id']])}}"
                               class="confirm ajax-get">删除</a>
                        </td>
                    </tr>
                @endforeach
            @else
                <td colspan="6" class="text-center"> aOh! 暂时还没有内容!</td>
            @endif
            </tbody>
        </table>

    </div>
    <div class="page">
        @if($rows['last_page']>1)
            <div>
                @if($rows['prev_page_url'])
                    <a class="prev" href="{{$rows['prev_page_url']}}">&lt;&lt;</a>
                @endif
                @if(count($rows['pageNoList']))
                    @foreach($rows['pageNoList'] as $v)
                        @if($rows['current_page'] == $v)
                            <span class="current">{{$v}}</span>
                        @else
                            <a class="num" href="{{urlAdmin('auth','getIndex',['page'=>$v])}}">{{$v}}</a>
                        @endif
                    @endforeach
                @endif
                @if($rows['next_page_url'])
                    <a class="next" href="{{$rows['next_page_url']}}">&gt;&gt;</a>
                @endif
                <span class="rows">共 {{$rows['total']}} 条记录</span>
            </div>
        @endif
    </div>
@endsection